#include "PlayState.h"
#include "Game.h"
#include "AntWorld.h"
#include "GroundPlane.h"

#include <GL\glut.h>

PlayState::PlayState()
{

	//float Red,Green,Blue,Alpha;
	//Vec3f TestTextCord;
	//TestTextCord.X=-7,TestTextCord.Y=1,TestTextCord.Z=3;
	//std::string TestString;
	//TestString ="The Test String";
	//
	//
	//
	////m_text.TextColour(Red=0, Green=1, Blue=0, Alpha = .5);
	//m_text.TextColour(0,1,0,0);
	//m_text.TextCord(TestTextCord);
	//m_text.SetText(TestString);
	float SetX=-30;
	float SetY=1;
	float SetZ=-25;
	float ZOffSet=2;

	std::string Seek="Seek";
	Vec3f SeekCord(SetX,SetY,SetZ);

	std::string Flee="Flee";
	Vec3f FleeCord(SetX, SetY, SetZ+=ZOffSet);

	std::string Seperation="Seperation";
	Vec3f SepCord(SetX, SetY, SetZ+=ZOffSet);

	std::string Slow="Slow";
	Vec3f SlowCord(SetX, SetY, SetZ+=ZOffSet);

	std::string Wander="Wander";
	Vec3f WanCord(SetX, SetY, SetZ+=ZOffSet);

	std::string Follow="Follow";
	Vec3f FolCord(SetX, SetY, SetZ+=ZOffSet);

	std::string Instructions="Use WASD or arrow keys to move a predator, Maybe herd the ants to their food?";
	Vec3f InstrCord(-10, 1, -25);

	m_text.DefineAll(1,0,0,0,Seek, SeekCord);
	m_text.AddToVector();
	m_text.DefineAll(.6,.4,0,0,Flee, FleeCord);
	m_text.AddToVector();
	m_text.DefineAll(.2,.8,.1,0,Seperation, SepCord);
	m_text.AddToVector();
	m_text.DefineAll(0,1,.2,0,Slow, SlowCord);
	m_text.AddToVector();
	m_text.DefineAll(0,.4,1,0,Wander, WanCord);
	m_text.AddToVector();
	m_text.DefineAll(1,1,1,1,Follow,FolCord);
	m_text.AddToVector();
	m_text.DefineAll(1,0,0,1, Instructions,InstrCord);
	m_text.AddToVector();


	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	
	glEnable(GL_DEPTH_TEST);
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);

	gluPerspective(45,1280/800,1,1000);
	//gluLookAt(0, 15, 45, 0, 0, 0, 0, 1, 0);
	gluLookAt(0, 85.0f, 1.0f, 0, 0, 0, 0, 1.0, 0);

	//m_light.SetDirectionalLight(Vec3f( 0,-1, 0));
	m_light.SetPositionalLight(Vec3f( 0, 2, 6));
	m_light.SetAmbient(1, 1.0f,1.0f, 1.0f);
	m_light.SetSpecular( 1, 0, 0.75f, 0);
	m_light.SetDiffuse(1, 0.5f,0.5f, 0.5f);
	m_light.LightOn();


	TheAntWorld::Instance();


}

void PlayState::Draw()
{

	glClearColor(0, 0, 0, 1);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	m_text.DrawVec();

	TheGame::Instance()->DrawGameObjects();
}

void PlayState::Update()
{
	TheGame::Instance()->UpdateGameObjects();
}